
/**
 * This is a generated class and is not intended for modification.  
 */
package valueObjects
{
import com.adobe.fiber.styles.IStyle;
import com.adobe.fiber.styles.Style;
import com.adobe.fiber.styles.StyleValidator;
import com.adobe.fiber.valueobjects.AbstractEntityMetadata;
import com.adobe.fiber.valueobjects.AvailablePropertyIterator;
import com.adobe.fiber.valueobjects.IPropertyIterator;
import mx.events.ValidationResultEvent;
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.valueobjects.IModelType;
import mx.events.PropertyChangeEvent;

use namespace model_internal;

[ExcludeClass]
internal class _ProductoDTOEntityMetadata extends com.adobe.fiber.valueobjects.AbstractEntityMetadata
{
    private static var emptyArray:Array = new Array();

    model_internal static var allProperties:Array = new Array("id_tipo_producto", "preciolista", "str_codigo", "id_producto", "str_descripcion");
    model_internal static var allAssociationProperties:Array = new Array();
    model_internal static var allRequiredProperties:Array = new Array("id_tipo_producto", "preciolista", "str_codigo", "id_producto", "str_descripcion");
    model_internal static var allAlwaysAvailableProperties:Array = new Array("id_tipo_producto", "preciolista", "str_codigo", "id_producto", "str_descripcion");
    model_internal static var guardedProperties:Array = new Array();
    model_internal static var dataProperties:Array = new Array("id_tipo_producto", "preciolista", "str_codigo", "id_producto", "str_descripcion");
    model_internal static var sourceProperties:Array = emptyArray
    model_internal static var nonDerivedProperties:Array = new Array("id_tipo_producto", "preciolista", "str_codigo", "id_producto", "str_descripcion");
    model_internal static var derivedProperties:Array = new Array();
    model_internal static var collectionProperties:Array = new Array();
    model_internal static var collectionBaseMap:Object;
    model_internal static var entityName:String = "ProductoDTO";
    model_internal static var dependentsOnMap:Object;
    model_internal static var dependedOnServices:Array = new Array();
    model_internal static var propertyTypeMap:Object;

    
    model_internal var _id_tipo_productoIsValid:Boolean;
    model_internal var _id_tipo_productoValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _id_tipo_productoIsValidCacheInitialized:Boolean = false;
    model_internal var _id_tipo_productoValidationFailureMessages:Array;
    
    model_internal var _preciolistaIsValid:Boolean;
    model_internal var _preciolistaValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _preciolistaIsValidCacheInitialized:Boolean = false;
    model_internal var _preciolistaValidationFailureMessages:Array;
    
    model_internal var _str_codigoIsValid:Boolean;
    model_internal var _str_codigoValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _str_codigoIsValidCacheInitialized:Boolean = false;
    model_internal var _str_codigoValidationFailureMessages:Array;
    
    model_internal var _id_productoIsValid:Boolean;
    model_internal var _id_productoValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _id_productoIsValidCacheInitialized:Boolean = false;
    model_internal var _id_productoValidationFailureMessages:Array;
    
    model_internal var _str_descripcionIsValid:Boolean;
    model_internal var _str_descripcionValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _str_descripcionIsValidCacheInitialized:Boolean = false;
    model_internal var _str_descripcionValidationFailureMessages:Array;

    model_internal var _instance:_Super_ProductoDTO;
    model_internal static var _nullStyle:com.adobe.fiber.styles.Style = new com.adobe.fiber.styles.Style();

    public function _ProductoDTOEntityMetadata(value : _Super_ProductoDTO)
    {
        // initialize property maps
        if (model_internal::dependentsOnMap == null)
        {
            // dependents map
            model_internal::dependentsOnMap = new Object();
            model_internal::dependentsOnMap["id_tipo_producto"] = new Array();
            model_internal::dependentsOnMap["preciolista"] = new Array();
            model_internal::dependentsOnMap["str_codigo"] = new Array();
            model_internal::dependentsOnMap["id_producto"] = new Array();
            model_internal::dependentsOnMap["str_descripcion"] = new Array();

            // collection base map
            model_internal::collectionBaseMap = new Object();
        }

        // Property type Map
        model_internal::propertyTypeMap = new Object();
        model_internal::propertyTypeMap["id_tipo_producto"] = "String";
        model_internal::propertyTypeMap["preciolista"] = "Object";
        model_internal::propertyTypeMap["str_codigo"] = "Object";
        model_internal::propertyTypeMap["id_producto"] = "Object";
        model_internal::propertyTypeMap["str_descripcion"] = "String";

        model_internal::_instance = value;
        model_internal::_id_tipo_productoValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForId_tipo_producto);
        model_internal::_id_tipo_productoValidator.required = true;
        model_internal::_id_tipo_productoValidator.requiredFieldError = "id_tipo_producto is required";
        //model_internal::_id_tipo_productoValidator.source = model_internal::_instance;
        //model_internal::_id_tipo_productoValidator.property = "id_tipo_producto";
        model_internal::_preciolistaValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForPreciolista);
        model_internal::_preciolistaValidator.required = true;
        model_internal::_preciolistaValidator.requiredFieldError = "preciolista is required";
        //model_internal::_preciolistaValidator.source = model_internal::_instance;
        //model_internal::_preciolistaValidator.property = "preciolista";
        model_internal::_str_codigoValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForStr_codigo);
        model_internal::_str_codigoValidator.required = true;
        model_internal::_str_codigoValidator.requiredFieldError = "str_codigo is required";
        //model_internal::_str_codigoValidator.source = model_internal::_instance;
        //model_internal::_str_codigoValidator.property = "str_codigo";
        model_internal::_id_productoValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForId_producto);
        model_internal::_id_productoValidator.required = true;
        model_internal::_id_productoValidator.requiredFieldError = "id_producto is required";
        //model_internal::_id_productoValidator.source = model_internal::_instance;
        //model_internal::_id_productoValidator.property = "id_producto";
        model_internal::_str_descripcionValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForStr_descripcion);
        model_internal::_str_descripcionValidator.required = true;
        model_internal::_str_descripcionValidator.requiredFieldError = "str_descripcion is required";
        //model_internal::_str_descripcionValidator.source = model_internal::_instance;
        //model_internal::_str_descripcionValidator.property = "str_descripcion";
    }

    override public function getEntityName():String
    {
        return model_internal::entityName;
    }

    override public function getProperties():Array
    {
        return model_internal::allProperties;
    }

    override public function getAssociationProperties():Array
    {
        return model_internal::allAssociationProperties;
    }

    override public function getRequiredProperties():Array
    {
         return model_internal::allRequiredProperties;   
    }

    override public function getDataProperties():Array
    {
        return model_internal::dataProperties;
    }

    public function getSourceProperties():Array
    {
        return model_internal::sourceProperties;
    }

    public function getNonDerivedProperties():Array
    {
        return model_internal::nonDerivedProperties;
    }

    override public function getGuardedProperties():Array
    {
        return model_internal::guardedProperties;
    }

    override public function getUnguardedProperties():Array
    {
        return model_internal::allAlwaysAvailableProperties;
    }

    override public function getDependants(propertyName:String):Array
    {
       if (model_internal::nonDerivedProperties.indexOf(propertyName) == -1)
            throw new Error(propertyName + " is not a data property of entity ProductoDTO");
            
       return model_internal::dependentsOnMap[propertyName] as Array;  
    }

    override public function getDependedOnServices():Array
    {
        return model_internal::dependedOnServices;
    }

    override public function getCollectionProperties():Array
    {
        return model_internal::collectionProperties;
    }

    override public function getCollectionBase(propertyName:String):String
    {
        if (model_internal::collectionProperties.indexOf(propertyName) == -1)
            throw new Error(propertyName + " is not a collection property of entity ProductoDTO");

        return model_internal::collectionBaseMap[propertyName];
    }
    
    override public function getPropertyType(propertyName:String):String
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
            throw new Error(propertyName + " is not a property of ProductoDTO");

        return model_internal::propertyTypeMap[propertyName];
    }

    override public function getAvailableProperties():com.adobe.fiber.valueobjects.IPropertyIterator
    {
        return new com.adobe.fiber.valueobjects.AvailablePropertyIterator(this);
    }

    override public function getValue(propertyName:String):*
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " does not exist for entity ProductoDTO");
        }

        return model_internal::_instance[propertyName];
    }

    override public function setValue(propertyName:String, value:*):void
    {
        if (model_internal::nonDerivedProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " is not a modifiable property of entity ProductoDTO");
        }

        model_internal::_instance[propertyName] = value;
    }

    override public function getMappedByProperty(associationProperty:String):String
    {
        switch(associationProperty)
        {
            default:
            {
                return null;
            }
        }
    }

    override public function getPropertyLength(propertyName:String):int
    {
        switch(propertyName)
        {
            default:
            {
                return 0;
            }
        }
    }

    override public function isAvailable(propertyName:String):Boolean
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " does not exist for entity ProductoDTO");
        }

        if (model_internal::allAlwaysAvailableProperties.indexOf(propertyName) != -1)
        {
            return true;
        }

        switch(propertyName)
        {
            default:
            {
                return true;
            }
        }
    }

    override public function getIdentityMap():Object
    {
        var returnMap:Object = new Object();

        return returnMap;
    }

    [Bindable(event="propertyChange")]
    override public function get invalidConstraints():Array
    {
        if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_invalidConstraints;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_invalidConstraints;        
        }
    }

    [Bindable(event="propertyChange")]
    override public function get validationFailureMessages():Array
    {
        if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_validationFailureMessages;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_validationFailureMessages;
        }
    }

    override public function getDependantInvalidConstraints(propertyName:String):Array
    {
        var dependants:Array = getDependants(propertyName);
        if (dependants.length == 0)
        {
            return emptyArray;
        }

        var currentlyInvalid:Array = invalidConstraints;
        if (currentlyInvalid.length == 0)
        {
            return emptyArray;
        }

        var filterFunc:Function = function(element:*, index:int, arr:Array):Boolean
        {
            return dependants.indexOf(element) > -1;
        }

        return currentlyInvalid.filter(filterFunc);
    }

    /**
     * isValid
     */
    [Bindable(event="propertyChange")] 
    public function get isValid() : Boolean
    {
        if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_isValid;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_isValid;
        }
    }

    [Bindable(event="propertyChange")]
    public function get isId_tipo_productoAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPreciolistaAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isStr_codigoAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isId_productoAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isStr_descripcionAvailable():Boolean
    {
        return true;
    }


    /**
     * derived property recalculation
     */
    public function invalidateDependentOnId_tipo_producto():void
    {
        if (model_internal::_id_tipo_productoIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfId_tipo_producto = null;
            model_internal::calculateId_tipo_productoIsValid();
        }
    }
    public function invalidateDependentOnPreciolista():void
    {
        if (model_internal::_preciolistaIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfPreciolista = null;
            model_internal::calculatePreciolistaIsValid();
        }
    }
    public function invalidateDependentOnStr_codigo():void
    {
        if (model_internal::_str_codigoIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfStr_codigo = null;
            model_internal::calculateStr_codigoIsValid();
        }
    }
    public function invalidateDependentOnId_producto():void
    {
        if (model_internal::_id_productoIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfId_producto = null;
            model_internal::calculateId_productoIsValid();
        }
    }
    public function invalidateDependentOnStr_descripcion():void
    {
        if (model_internal::_str_descripcionIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfStr_descripcion = null;
            model_internal::calculateStr_descripcionIsValid();
        }
    }

    model_internal function fireChangeEvent(propertyName:String, oldValue:Object, newValue:Object):void
    {
        this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, propertyName, oldValue, newValue));
    }

    [Bindable(event="propertyChange")]   
    public function get id_tipo_productoStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get id_tipo_productoValidator() : StyleValidator
    {
        return model_internal::_id_tipo_productoValidator;
    }

    model_internal function set _id_tipo_productoIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_id_tipo_productoIsValid;         
        if (oldValue !== value)
        {
            model_internal::_id_tipo_productoIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "id_tipo_productoIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get id_tipo_productoIsValid():Boolean
    {
        if (!model_internal::_id_tipo_productoIsValidCacheInitialized)
        {
            model_internal::calculateId_tipo_productoIsValid();
        }

        return model_internal::_id_tipo_productoIsValid;
    }

    model_internal function calculateId_tipo_productoIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_id_tipo_productoValidator.validate(model_internal::_instance.id_tipo_producto)
        model_internal::_id_tipo_productoIsValid_der = (valRes.results == null);
        model_internal::_id_tipo_productoIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::id_tipo_productoValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::id_tipo_productoValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get id_tipo_productoValidationFailureMessages():Array
    {
        if (model_internal::_id_tipo_productoValidationFailureMessages == null)
            model_internal::calculateId_tipo_productoIsValid();

        return _id_tipo_productoValidationFailureMessages;
    }

    model_internal function set id_tipo_productoValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_id_tipo_productoValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_id_tipo_productoValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "id_tipo_productoValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get preciolistaStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get preciolistaValidator() : StyleValidator
    {
        return model_internal::_preciolistaValidator;
    }

    model_internal function set _preciolistaIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_preciolistaIsValid;         
        if (oldValue !== value)
        {
            model_internal::_preciolistaIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "preciolistaIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get preciolistaIsValid():Boolean
    {
        if (!model_internal::_preciolistaIsValidCacheInitialized)
        {
            model_internal::calculatePreciolistaIsValid();
        }

        return model_internal::_preciolistaIsValid;
    }

    model_internal function calculatePreciolistaIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_preciolistaValidator.validate(model_internal::_instance.preciolista)
        model_internal::_preciolistaIsValid_der = (valRes.results == null);
        model_internal::_preciolistaIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::preciolistaValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::preciolistaValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get preciolistaValidationFailureMessages():Array
    {
        if (model_internal::_preciolistaValidationFailureMessages == null)
            model_internal::calculatePreciolistaIsValid();

        return _preciolistaValidationFailureMessages;
    }

    model_internal function set preciolistaValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_preciolistaValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_preciolistaValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "preciolistaValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get str_codigoStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get str_codigoValidator() : StyleValidator
    {
        return model_internal::_str_codigoValidator;
    }

    model_internal function set _str_codigoIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_str_codigoIsValid;         
        if (oldValue !== value)
        {
            model_internal::_str_codigoIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "str_codigoIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get str_codigoIsValid():Boolean
    {
        if (!model_internal::_str_codigoIsValidCacheInitialized)
        {
            model_internal::calculateStr_codigoIsValid();
        }

        return model_internal::_str_codigoIsValid;
    }

    model_internal function calculateStr_codigoIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_str_codigoValidator.validate(model_internal::_instance.str_codigo)
        model_internal::_str_codigoIsValid_der = (valRes.results == null);
        model_internal::_str_codigoIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::str_codigoValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::str_codigoValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get str_codigoValidationFailureMessages():Array
    {
        if (model_internal::_str_codigoValidationFailureMessages == null)
            model_internal::calculateStr_codigoIsValid();

        return _str_codigoValidationFailureMessages;
    }

    model_internal function set str_codigoValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_str_codigoValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_str_codigoValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "str_codigoValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get id_productoStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get id_productoValidator() : StyleValidator
    {
        return model_internal::_id_productoValidator;
    }

    model_internal function set _id_productoIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_id_productoIsValid;         
        if (oldValue !== value)
        {
            model_internal::_id_productoIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "id_productoIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get id_productoIsValid():Boolean
    {
        if (!model_internal::_id_productoIsValidCacheInitialized)
        {
            model_internal::calculateId_productoIsValid();
        }

        return model_internal::_id_productoIsValid;
    }

    model_internal function calculateId_productoIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_id_productoValidator.validate(model_internal::_instance.id_producto)
        model_internal::_id_productoIsValid_der = (valRes.results == null);
        model_internal::_id_productoIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::id_productoValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::id_productoValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get id_productoValidationFailureMessages():Array
    {
        if (model_internal::_id_productoValidationFailureMessages == null)
            model_internal::calculateId_productoIsValid();

        return _id_productoValidationFailureMessages;
    }

    model_internal function set id_productoValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_id_productoValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_id_productoValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "id_productoValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get str_descripcionStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get str_descripcionValidator() : StyleValidator
    {
        return model_internal::_str_descripcionValidator;
    }

    model_internal function set _str_descripcionIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_str_descripcionIsValid;         
        if (oldValue !== value)
        {
            model_internal::_str_descripcionIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "str_descripcionIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get str_descripcionIsValid():Boolean
    {
        if (!model_internal::_str_descripcionIsValidCacheInitialized)
        {
            model_internal::calculateStr_descripcionIsValid();
        }

        return model_internal::_str_descripcionIsValid;
    }

    model_internal function calculateStr_descripcionIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_str_descripcionValidator.validate(model_internal::_instance.str_descripcion)
        model_internal::_str_descripcionIsValid_der = (valRes.results == null);
        model_internal::_str_descripcionIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::str_descripcionValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::str_descripcionValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get str_descripcionValidationFailureMessages():Array
    {
        if (model_internal::_str_descripcionValidationFailureMessages == null)
            model_internal::calculateStr_descripcionIsValid();

        return _str_descripcionValidationFailureMessages;
    }

    model_internal function set str_descripcionValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_str_descripcionValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_str_descripcionValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "str_descripcionValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }


     /**
     * 
     * @inheritDoc 
     */ 
     override public function getStyle(propertyName:String):com.adobe.fiber.styles.IStyle
     {
         switch(propertyName)
         {
            default:
            {
                return null;
            }
         }
     }
     
     /**
     * 
     * @inheritDoc 
     *  
     */  
     override public function getPropertyValidationFailureMessages(propertyName:String):Array
     {
         switch(propertyName)
         {
            case("id_tipo_producto"):
            {
                return id_tipo_productoValidationFailureMessages;
            }
            case("preciolista"):
            {
                return preciolistaValidationFailureMessages;
            }
            case("str_codigo"):
            {
                return str_codigoValidationFailureMessages;
            }
            case("id_producto"):
            {
                return id_productoValidationFailureMessages;
            }
            case("str_descripcion"):
            {
                return str_descripcionValidationFailureMessages;
            }
            default:
            {
                return emptyArray;
            }
         }
     }

}

}
